<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<head>
	<style type="text/css">
.detect{
	width: 100%;
	border:1px solid #B8BAB9;
	}
.detect td{
   	padding:  0.5em 0px 0.5em 0px;
	text-align: center;
	border:1px solid #B8BAB9;
}
#mainForm th {
	background:#E0E0E0;
}
.detect th{
 	padding:  0.5em 0px 0.5em 0px;
	text-align: center;
	border:1px solid #B8BAB9;
	color: #333333;
}
.yform{
margin: 0;
</style>
<script type="text/javascript">
$(document).ready(function() {
	$("#startTime").addClass("Wate").bind("click", function() {
		WdatePicker({
			skin : 'whyGreen',
			minDate : '1900-10-01',
			maxDate : '%y-%M-%d',
			dateFmt : 'yyyy-MM-dd'
		});
	});
	$("#endTime").addClass("Wate").bind("click", function() {
		WdatePicker({
			skin : 'whyGreen',
			minDate : '1900-10-01',
			maxDate : '%y-%M-%d',
			dateFmt : 'yyyy-MM-dd'
		});
	});
	$("#submit").click(function(){
	var batch = $("#batch").val();
	var projectId = $("#projectId").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	if( projectId != null && projectId != ""){
		if( batch != null && batch != ""){
			$(window.parent.batch(batch,startTime,endTime));
		}else{
			$(window.parent.batchPro(startTime,endTime));
		}
	}else if(projectId == null || projectId == ""){
			if(batch=="" || batch == null){
				alert("请选择批次");
				return false;
			}else{
				$(window.parent.batch(batch,startTime,endTime));
			}
		}
	});
})

function lookExcel(){
	var projectId = $("#projectId").val();
	var batch = $("#batch").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	window.location.href="${ctx}/detect/detect!windows.action?projectId="+projectId+"&batch="+batch+"&startTime="+startTime+"&endTime="+endTime;
}

function excel(id,projectId){
	$(window.parent.Excel(id,projectId));
}
</script>
</head>
<body>
<object id="factory" style="display:none;" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"></object> 
<script type="text/javascript"> 
function   window.onload()   { 
    //factory.printing.paperSize   =   "A3 " 
    factory.printing.header   =   " " 
    factory.printing.footer   =   " " 
    factory.printing.portrait   =   false 
    factory.printing.leftMargin   =   0.75 
    factory.printing.topMargin   =   1.5 
    factory.printing.rightMargin   =   0.75 
    factory.printing.bottomMargin   =   1.5 
    } 
</script> 

<div style="padding-top: 40px">
<table class="yform"><tr><td width="100%">
<form action="${ctx }/detect/detect!windows.action" method="get" id="form" class="yform" name="form1">
	<input type="hidden" name="projectId" id="projectId" value="${projectId }"/>
<table class="forprint">
<c:if test="${empty id }">	
<tr>
<td width="252px">提交时间：<input type="text" id="startTime"
		name="startTime" value="${startTime}" style="width: 172px;" /></td>
	<td width="208px">至&nbsp;&nbsp;&nbsp;<input type="text" id="endTime"
		name="endTime" value="${endTime}" style="width: 172px;" />
		</td>
		<td align="left"><div class="type-button"><input type="submit" 
	class="search" value="查询" /></div></td>
	</tr>
	</c:if>
	<tr>
	<c:if test="${empty id }">	
	<td>批次选择:<pt:labels name="batchList" type="batch" toScope="request" argument1="${projectId }" argument2="${startTime}" argument3="${endTime}"></pt:labels>
<s:select list="#request.batchList"  style="width: 180px;" name="batch" id="batch" listKey="label" listValue="value" emptyOption="true" onchange="lookExcel();"></s:select>
 </td>
 <td>&nbsp;</td>
</c:if>
<td>
<div class="type-button" style="text-align: right;">
<c:if test="${not empty id }">
<input type="button" class="button" onclick="excel('${id }','${projectId}');" value="导出" /></c:if>
<c:if test="${empty id }">
<input  type="button" class="submit" id="submit" value="导出" /></c:if>
<input type="button" class="button" onclick="factory.printing.PageSetup();" value="设置" />
<input type="button" class="button" onclick="factory.printing.Preview();" value="预览" />
<input type="button" class="button" onclick="factory.printing.Print(true); " value="打印" />
</div>
</td></tr>
</table>
</form>
</td></tr>

<tr><td align="center">
<c:choose>
<c:when test="${empty projectId && empty batch}"></c:when>
<c:otherwise>
<img alt="" src="${ctx }/servlet/displayChart?filename=${filename}" height="${jfreeChartBean.height}" width="${jfreeChartBean.width}">
</c:otherwise>
</c:choose>
</td></tr>

<tr><td>
<form action="${ctx }/detect/detect!windows.action" method="get" id="mainForm" class="yform" name="form2">
<input type="hidden" name="projectId" value="${projectId}"/>
<input type="hidden" name="batch" value="${batch}"/>
<input type="hidden" name="startTime" value="${startTime}"/>
<input type="hidden" name="endTime" value="${endTime}"/>
<table class="detect">
<tr><td colspan="22" align="center">监督抽检</td></tr>
<tr>
<th rowspan="2">工程名称<c:if test="${not empty projectId && not empty batch || not empty id}">(标段)</c:if>(批次)</th>
<th colspan="3" align="center">合计</th>  
<th colspan="3" align="center">路基工程</th>  <th colspan="3" align="center">路面工程</th>  	  <th colspan="3" align="center">桥梁工程</th>
<th colspan="3" align="center">隧道工程</th>  <th colspan="3" align="center">安全设施工程</th>   <th colspan="3" align="center">三大原材料</th>
</tr>

<tr>
<th>抽检数</th>   <th>合格数</th>   <th>合格率(%)</th>
<th>抽检数</th>   <th>合格数</th>   <th>合格率(%)</th>
<th>抽检数</th>   <th>合格数</th>   <th>合格率(%)</th>
<th>抽检数</th>   <th>合格数</th>   <th>合格率(%)</th>
<th>抽检数</th>   <th>合格数</th>   <th>合格率(%)</th>
<th>抽检数</th>   <th>合格数</th>   <th>合格率(%)</th>
<th>抽检数</th>   <th>合格数</th>   <th>合格率(%)</th>

</tr>

<c:forEach items="${page.result }" var="spotReport">
<tr>
<td><pt:text limit="8">${spotReport.projectInfo.projName }</pt:text>
<c:if test="${not empty projectId && not empty batch || not empty id}">
(<pt:labels type="sign" argument1="${spotReport.signid}" single="true"></pt:labels> )
</c:if>
(${spotReport.batch})</td>
<td>${spotReport.allCount }</td> <td>${spotReport.allPass }</td> <td>${spotReport.allTotalPassrate }</td>

<td>${spotReport.structurespot.allCountF200 }</td> <td>${spotReport.structurespot.allPassF200 }</td> <td>${spotReport.structurespot.totalPassrate }</td>

<td>${spotReport.surfacespot.allCountF300 }</td> <td>${spotReport.surfacespot.allPassF300 }</td> <td>${spotReport.surfacespot.totalPassrate }</td>

<td>${spotReport.bridgespot.allCountF400 }</td> <td>${spotReport.bridgespot.allPassF400 }</td> <td>${spotReport.bridgespot.totalPassrate }</td>

<td>${spotReport.tunnelspot.allCountF500 }</td> <td>${spotReport.tunnelspot.allPassF500 }</td> <td>${spotReport.tunnelspot.totalPassrate }</td>

<td>${spotReport.safetyspot.allCountF600 }</td> <td>${spotReport.safetyspot.allPassF600 }</td> <td>${spotReport.safetyspot.totalPassrate }</td>

<td>${spotReport.materialspot.allCountF900 }</td> <td>${spotReport.materialspot.allPassF900 }</td> <td>${spotReport.materialspot.totalPassrate }</td>
</tr>
</c:forEach>

</table>
<c:if test="${not empty projectId && not empty batch}">
<jsp:include page="/common/page.jsp"></jsp:include>
</c:if>
</form>
</td></tr></table>
</div>
</body>
